import logging
import traceback
from dataclasses import dataclass

from commons.request_util import logger


# # 生成日志对象
# from configs import setting
# logger = logging.getLogger()

@dataclass
class CaseInfo:
    # 必填
    feature: str
    story: str
    title: str
    request: dict
    validate:  dict
    # 选填
    extract: dict = None
    parametrize: list = None

# 校验测试类
def verify_yaml(caseinfo: dict,yaml_name):
    try:
        new_caseinfo = CaseInfo(**caseinfo)
        return new_caseinfo
    except Exception:
        logger.error(yaml_name + "：YAML测试用例不符合框架规范!\n")